package com.chenfan.common.utils;

import java.util.HashSet;
import java.util.Random;
import java.util.Set;
import java.util.UUID;

/**
 * token生成工具
 * 
 * api_token
 * user_token
 * 
 * @author lizhejin
 */
public class TokenUtil {
	
	/**
	 * @param arg
	 * @return token
	 */
	public static String tokenUserCreate(String arg) {
		String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
		String token = AESUtil.encrypt(uuid, arg);
		return token;
	}
	
	public static void main(String[] args) {
		Set<String> set = new HashSet<String>();
		for(int i = 0;i<100000;i++) {
			String random = new Random().nextInt(1000) + "";
			String token = tokenUserCreate(random);
			System.out.println(token);
			set.add(token);
			
		}
		System.out.println(set.size());
	}
}
